<?php

use Tools\RedisPackage;

$redis = new RedisPackage();
$redis->lRem('prize_num_list',1,0);//删除原来的
for($i =1;$i<=$data["prize_num"];$i++){
    $redis->lPush('prize_num_list',1);//写入
}
// 当天
$expireTime = mktime(23, 59, 59, date("m"), date("d"), date("Y"));
//设置键的过期时间
$redis->expireAt('prize_num_list', $expireTime);



 //加回库存
$redis = new RedisPackage();
$redis->lPush('prize_num_list',1);//写入



 //查询数量  
$redis = new RedisPackage();
$data_prize_lLen = $redis->lLen('prize_num_list_8_8'); //获取长度
if($data_prize_lLen == false || $data_prize_lLen<=0){
    return ['code' => 1001, 'msg' => '名额已上限'];
}

//扣掉数量
$data_prize_lPop = $redis->lPop($redis_name);
if(!$data_prize_lPop){
    return ['code' => 1007, 'msg' =>'名额已上限'];
}
//文档地址
//https://www.open-open.com/lib/view/open1355830836135.html